Skip to content

Comments

Improvements#43

Merged
aleguy02 merged 3 commits intomainfrom
deployment
Sep 4, 2025
Merged

Improvements#43
aleguy02 merged 3 commits intomainfrom
deployment

Conversation

@aleguy02
Copy link
Owner

@aleguy02 aleguy02 commented Sep 4, 2025

Summary by CodeRabbit

  • New Features

    • App container and local defaults now serve on port 3000 (was 5000); compose and example env updated to match.
  • Chores

    • SOC scraping tool now runs tasks concurrently, improving performance and reducing runtime.
    • Added run summary (total, successes, failures, elapsed time) and clearer progress/error logging.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 4, 2025

Walkthrough

Ports changed from 5000 → 3000 in Dockerfile, compose.yaml, and example.env. scripts/scrape_soc.py was rewritten to run semester scrapes concurrently using ThreadPoolExecutor, adding _scrape_one and main, aggregated results with success/failure counts and overall timing, and updated the __main__ guard to call main().

Changes

Cohort / File(s) Summary
Container port update
Dockerfile, compose.yaml, example.env
Updated exposed and bound port from 5000 to 3000 in Dockerfile (EXPOSE, CMD), changed service port mapping in compose.yaml from 5000:50003000:3000, and updated example URL in example.env from localhost:5000localhost:3000.
Scraper concurrency and orchestration
scripts/scrape_soc.py
Replaced sequential scraping with concurrent execution using ThreadPoolExecutor and as_completed; added `_scrape_one(s: str, term: str) -> tuple[str, bool, str

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Main as main()
  participant Pool as ThreadPoolExecutor (max_workers=8)
  participant Worker as _scrape_one(s, term)
  participant SOC as SOC API
  participant FS as File System

  User->>Main: run scrape_soc.py
  Main->>Main: build semester tasks
  Main->>Pool: submit tasks
  par concurrent semesters
    Pool->>Worker: execute _scrape_one
    Worker->>SOC: fetch semester data
    SOC-->>Worker: data / error
    alt success
      Worker->>FS: write soc_scraped_<s>.json
      Worker-->>Pool: (s, True, None)
    else failure
      Worker-->>Pool: (s, False, "error msg")
    end
  end
  loop as tasks complete
    Pool-->>Main: results via as_completed
    Main->>Main: update counts
  end
  Main->>User: print summary (total, successes, failures, elapsed)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

Ports leap to three-thousand, snug and neat,
Containers hum and threads tap feet.
Eight paws scurry, semesters in tow,
Files written down where the data flow.
A rabbit cheers: "Done!" — and off we go. 🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ae38c96 and 0a030a1.

📒 Files selected for processing (1)
  • example.env (1 hunks)
🔇 Additional comments (1)
example.env (1)

1-1: Include URL scheme in environment variable

Replace in example.env:

-URL=localhost:3000
+URL=http://localhost:3000

If running inside Docker Compose where the API service is named backend, use:

URL=http://backend:3000
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch deployment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@aleguy02 aleguy02 changed the title Deployment Improvements Sep 4, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
Dockerfile (1)

12-14: Bind Gunicorn to PORT env with sane default.

Keeps 3000 by default while allowing overrides in different deploy targets.

-CMD ["gunicorn", "--bind", "0.0.0.0:3000", "app:app"]
+CMD ["sh", "-c", "gunicorn --bind 0.0.0.0:${PORT:-3000} app:app"]
 
-EXPOSE 3000
+EXPOSE 3000
scripts/scrape_soc.py (1)

145-166: Return a proper exit code and right-size worker count.

Improves CI usability and avoids oversubscribing when fewer semesters exist.

 def main():
-    WORKERS = 8
-    items = list(semesters.items())
+    items = list(semesters.items())
+    WORKERS = min(8, len(items))
     results: list[tuple[str, bool, str | None]] = []
@@
-    if failed:
+    if failed:
         print("Failed semesters:")
         for s, _, err in failed:
             print(f"  - {s}: {err}")
+    return 0 if not failed else 1
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e40ccac and ae38c96.

📒 Files selected for processing (3)
  • Dockerfile (1 hunks)
  • compose.yaml (1 hunks)
  • scripts/scrape_soc.py (2 hunks)
🧰 Additional context used
🪛 Ruff (0.12.2)
scripts/scrape_soc.py

138-138: Consider moving this statement to an else block

(TRY300)


139-139: Do not catch blind exception: Exception

(BLE001)

🔇 Additional comments (1)
scripts/scrape_soc.py (1)

9-9: LGTM: concurrent futures import.

@aleguy02 aleguy02 merged commit f69a447 into main Sep 4, 2025
2 checks passed
@aleguy02 aleguy02 deleted the deployment branch September 4, 2025 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant